package com.minelx.serverandclient.common;

import java.util.stream.Stream;

public class ArrayUtils {
	public static byte[] concat(byte[]... bytes) {
		return Stream.of(bytes)
				.reduce(ArrayUtils::concat0)
				.orElse(new byte[0]);
	}

	private static byte[] concat0(byte[] left, byte[] right){
		byte[] result = new byte[left.length + right.length];
		System.arraycopy(left, 0, result, 0, left.length);
		System.arraycopy(right, 0, result, left.length, right.length);
		return result;
	}
}
